﻿using System;
using System.Collections.Generic;
using NUnit.Framework;
using Xenta.Enums;
using Xenta.Operations;

namespace Xenta.Tests.Operations
{
    [TestFixture]
    public class CatalogTagTests : OperationTest
    {
        protected override IEnumerable<Type> ModelMappings
        {
            get
            {
                return NHMappings.ALL;
            }
        }

        [Test]
        public void Can_CRUD()
        {
            var tag = Processor.Execute(new CreateCatalogTag
            {
                Flags = CatalogTagFlags.None
            }).Result;

            Assert.NotNull(tag);
            tag.AreEqual(Processor.Execute(new GetCatalogTag
            {
                EntityID = tag.EntityID
            }).Result);

            var upd_tag = Processor.Execute(new UpdateCatalogTag
            {
                EntityID = tag.EntityID,
                Flags = CatalogTagFlags.Active
            }).Result;

            Assert.NotNull(upd_tag);
            upd_tag.AreEqual(tag);
            upd_tag.Flags.AreEqual(CatalogTagFlags.Active);

            Processor.Execute(new DeleteCatalogTag
            {
                EntityID = tag.EntityID
            });
        }
    }
}
